package com.ioe.p2p.service;

import java.io.IOException;
import java.nio.channels.DatagramChannel;
import java.nio.channels.Selector;

import static com.ioe.p2p.util.CommonUtil.log;

/**
 * @author tanbo
 * @create 2023/10/8
 */
public abstract class Processor {


    /**
     * 初始化
     */
    abstract public Processor init(DatagramChannel dc, Selector selector);

    /**
     * 开始流程
     */
    abstract public Processor begin() throws IOException;

    /**
     * 完成流程
     */
    abstract public void complete() throws IOException;

    /**
     * 失败
     */
    public void fail(Exception e){
        e.printStackTrace();
    }

    /**
     * 关闭
     */
    public void close(){}

}
